home *** CD-ROM | disk | FTP | other *** search
- #include "neko.h"
-
- /* assume BITMAP_WIDTH==32 */
- void draw16(win, work, x, y, width, x2, y2, w, h)
- struct window *win;
- short *work;
- int x, y, width, x2, y2, w, h;
- {
- extern BitmapData BitmapDataTable[];
- extern int neko_id;
- extern void _draw16();
-
- _draw16(work + y * width + x, (width - w)*2, /* dst */
- BitmapDataTable + neko_id, y2 * (win->w >> 3), 1<<x2,
- w, h);
- }
-
- void draw4(win, work, x, y, width, x2, y2, w, h)
- struct window *win;
- char *work;
- int x, y, width, x2, y2, w, h;
- {
- extern BitmapData BitmapDataTable[];
- extern int col16_0, col16_1;
- extern int neko_id, BlackPixel, WhitePixel;
- extern void _draw4();
-
- _draw4(work + y * width + x, width - w, /* dst */
- BitmapDataTable + neko_id, y2 * (win->w >> 3), 1<<x2,
- w, h, col16_0, col16_1);
- }
-
- void draw4f(win, work, x, y, width, x2, y2, w, h)
- struct window *win;
- char *work;
- int x, y, width, x2, y2, w, h;
- {
- char *p;
- extern int col16_f;
-
- p = work + y * width + x;
- width -= w;
- while (--h >= 0){
- x = w;
- while (--x >= 0)
- *p++ = col16_f;
- p += width;
- }
- }
-
- void draw16f(win, work, x, y, width, x2, y2, w, h)
- struct window *win;
- u_short *work;
- int x, y, width, x2, y2, w, h;
- {
- u_short *p;
- extern u_short col32f();
-
- p = work + y * width + x;
- width -= w;
- while (--h >= 0){
- x = w;
- while (--x >= 0)
- *p++ = col32f(*p);
- p += width ;
- }
- }
-
- int col32fmr = 90;
- int col32fmg = 90;
- int col32fmb = 90;
- int col32far = 0;
- int col32fag = 0;
- int col32fab = 0;
-
- u_short col32f(u_short pixel)
- {
- int r, g, b;
-
- b = pixel & 0x1f;
- pixel >>= 5;
- r = pixel & 0x1f;
- pixel >>= 5;
- g = pixel & 0x1f;
-
- r = _col32f(r, col32fmr, col32far);
- g = _col32f(g, col32fmg, col32fag);
- b = _col32f(b, col32fmb, col32fab);
-
- pixel = (g << 10) + (r << 5) + b;
- return (pixel);
- }
-
- _col32f(int x, int mul, int add)
- {
- x *= mul;
- x /= 100;
- x += add;
- if (x < 0)
- x = 0;
- else if (x >= 32)
- x = 31;
- return (x);
- }
-